Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
simonewebdesign / master.js
Created July 9, 2013 09:02
How to use RequireJS with NivoSlider
<script src="/scripts/require.js"></script>
<script src="/scripts/require.config.js"></script>
<script>
require(['slider'], function ($) {
console.log($); // jquery with slider
//console.log($('.slide').nivoSlider({}));
});
</script>
Object.prototype.getName = function() {
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec((this).constructor.toString());
return (results && results.length > 1) ? results[1] : "";
};
@simonewebdesign
simonewebdesign / HelloWorld.hs
Created June 19, 2013 13:13
Say "Hello, World!" in Haskell
main = putStrLn "Hello, World!"
@simonewebdesign
simonewebdesign / Preferences.sublime-settings
Last active December 17, 2015 18:49
My super cool Sublime Text 3 user settings preferences
{
"theme": "Soda Dark 3.sublime-theme",
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
// "color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
// "theme": "Spacegray.sublime-theme",
// "color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
@simonewebdesign
simonewebdesign / inheritance.js
Created May 16, 2013 10:47
Simple JavaScript inheritance
function Animal() {
/* properties */
this.isWild = true;
this.name = '';
this.sound = '';
this.height = 0; // cm
this.weight = 0; // kg
this.speed = 0; // km/h
this.age = 0; // years old
@simonewebdesign
simonewebdesign / hack.php
Last active December 16, 2015 19:09 — forked from anonymous/hack.php
I did it for teh lulz
<?php
class Foo {
public function bar() {
return "bar";
}
public static function baz() {
@simonewebdesign
simonewebdesign / xhr.js
Last active December 16, 2015 17:49
XMLHttpRequest - the standard way
// Full docs: https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest
var xhr,
url = "menu.html",
method = "GET";
if (XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xhr = new XMLHttpRequest();
} else {
@simonewebdesign
simonewebdesign / optional_parameters.php
Created April 23, 2013 09:29
Optional parameters in PHP
<?php
function foo() {
$numargs = func_num_args();
echo "Number of arguments: $numargs<br />\n";
if ($numargs >= 2) {
echo "Second argument is: " . func_get_arg(1) . "<br />\n";
}
@simonewebdesign
simonewebdesign / editor-demo.html
Created April 17, 2013 20:06
How to make a real-time in-browser editor with the HTML5′s contenteditable attribute -
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title contenteditable>Hey, buddy!</title>
<style class="default">
* {
transition: all .5s ease;
}
@simonewebdesign
simonewebdesign / helloworld.e
Created April 13, 2013 10:29
Say "Hello, World!" in Euphoria
puts(1, "Hello, World!")