[ create a new paste ] login | about

cms

Name: Christian C. Salvado
Email:
Site/Blog: http://friendfeed.com/cms
Location: Guatemala
Default language: C
Favorite languages: C#, JavaScript, F#, Haskell, Ruby
About:

Saved pastes by cms:

PHP, pasted on Nov 6:
1
2
3
4
5
<?php

var_dump('aa' <= 'z'); // true
//....
var_dump('yz' <= 'z'); // true
...
view (6 lines, 3 lines of output)
C, pasted on Sep 2:
1
2
3
4
5
void reverse(char s[])
{
  int i, j, t;
  for(i = 0, j = strlen(s)-1; i < j; i++, j--)
  {
...
view (18 lines, 1 line of output)
PHP, pasted on Feb 1:
1
2
3
4
<?php
  $phpArray = array("foo", "bar", "baz");
  //....
?>
...
view (8 lines, 4 lines of output)
PHP, pasted on Dec 18:
1
2
3
4
5
<?
$date1 = strtotime('2009-01-01');
$date2 = strtotime('2010-01-01');

while ($date1 <= $date2) {
...
view (8 lines, 13 lines of output)
PHP, pasted on Nov 22:
1
2
3
4
<?
$jsonString = '[{"name":"john","id":5932725006},{"name":"max","id":4953467146}]';

echo preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $jsonString);
view (4 lines, 1 line of output)
PHP, pasted on Nov 22:
1
2
3
4
<?
$jsonString = '[{"name":"john","id":5932725006},{"name":"max","id":4953467146}]';

echo preg_replace("/(\d+)/", '"\\1"', $jsonString);
view (4 lines, 1 line of output)
Scheme, pasted on Oct 16:
1
2
3
4
5
(let ((l '((4 3 1) (5 6 8))))
  (write (list-ref l 0)) ; get the element at index 0
) 

(let ((l '((4 3 1) (5 6 8))))
...
view (7 lines, 1 line of output)
Scheme, pasted on Oct 16:
1
2
3
(let ((l '((4 3 1) (5 6 8))))
  (write (list-ref l 0))
) ; get the element at index 0
view (4 lines, 1 line of output)
Python, pasted on Oct 10:
1
2
3
4
5
def sqrt(x):
    ans = 0
    if x >= 0:
        while ans*ans < x:
            ans = ans + 1
...
view (17 lines, 2 lines of output, 1 comment)
PHP, pasted on Sep 20:
1
2
3
4
5
<?
$jsonString = '[{"id":1,"name":"Test nameu","phone":"214748364723432432"},{"id":2,"name":"Next name","phone":3774387}]';
$decoded = json_decode($jsonString);

foreach ($decoded as $obj) {
...
view (10 lines, 2 lines of output)
PHP, pasted on Sep 20:
1
2
3
4
5
<?
$jsonString = '[{"id":1,"name":"Test nameu","phone":"214748364723432432"},{"id":2,"name":"Next name","phone":3774387}]';
$decoded = json_decode($jsonString);

foreach ($decoded as $obj) {
...
view (11 lines, 2 lines of output)
PHP, pasted on Sep 16:
1
2
3
4
5
<?php
function zip($n1, $n2)
{
    return $n1 . $n2;
}
...
view (11 lines, 8 lines of output)
PHP, pasted on Sep 10:
1
2
3
4
5
    <?
    $string = 'test1, test2, test3, test4,';
    $string = substr($string, 0, -1);
    $array = explode(',', $string);
    var_dump($array);
view (5 lines, 10 lines of output)
PHP, pasted on Sep 10:
1
2
3
4
<?
$string = 'test1, test2, test3, test4,';
//$string = substr($string, 0, -1);
var_dump(explode(',', $string));
view (4 lines, 12 lines of output)
Ruby, pasted on Sep 6:
1
print Time.at(1252268867928/1000)
view (1 line, 1 line of output)
PHP, pasted on Sep 4:
1
2
3
4
5
<?

function urlFriendly($title) 
{
    $title = preg_replace(array('/[^\w\s]/i', '/\s+/i'), array('','-'), $title);
...
view (10 lines, 1 line of output)
PHP, pasted on Aug 31:
1
2
3
<?
$year = date('Y');
$nextYear = $year + 1;
...
view (6 lines, 1 line of output, 5 comments)
PHP, pasted on Aug 17:
1
2
3
4
5
<?

$keys = array(
"0" => "sss",
"1" => "wst",
...
view (27 lines, 42 lines of output)
C, pasted on Dec 13:
1
2
3
4
5
#include<stdio.h>

int add(int x, int y) {
    int a, b;
    do {
...
view (18 lines, 1 line of output, 1 comment)
PHP, pasted on Nov 20:
1
2
3
4
5
<?php
class foo
{
    public function init()
    {
...
view (37 lines, 2 lines of output)
C, pasted on Nov 16:
1
2
3
4
5
#include<stdio.h>

unsigned int fib(unsigned int n)
{
	return n < 2 ? n : fib(n-1) + fib(n-2);
...
view (36 lines, 105 lines of output)