With this script, you can easily update a git repo.
curl -# https://gist.githubusercontent.com/Menencia/6435756/raw/update.sh > update.sh
curl -# https://gist.githubusercontent.com/Menencia/6435756/raw/version.sh > version.sh
<?php | |
// ORM request | |
$v = ORM::factory('user')->where('activated', '=', 1); | |
// Checks the number of results | |
$x = clone $v; | |
var_dump($x->count_all()); | |
// Operations that would change the number of results |
<?php | |
// Data to send | |
$res = array('success' => TRUE); | |
// Disable auto_render | |
$this->auto_render = FALSE; | |
// Return JSON | |
$this->response |
<?php | |
Route::set('project_add', 'project/add/<section>', | |
array( | |
'section' => '(link)', | |
)) | |
->defaults(array( | |
'controller' => 'project', | |
'action' => 'add_{$section}', | |
)); |
{ | |
"scope": "source.php - variable.other.php", | |
"completions": | |
[ | |
{ "trigger": "HTML::anchor", "contents": "HTML::anchor(${1:uri}, ${2:title = NULL}, ${3:attributes = NULL}, ${4:protocol = NULL})" }, | |
{ "trigger": "HTML::attributes", "contents": "HTML::attributes(${1:attributes = NULL})" }, | |
{ "trigger": "HTML::chars", "contents": "HTML::chars(${1:value = NULL}, ${2:double_encode = TRUE})" }, | |
{ "trigger": "HTML::email", "contents": "HTML::email(${1:email})" }, | |
{ "trigger": "HTML::entities", "contents": "HTML::entities(${1:value}, ${2:double_encode = TRUE})" }, |
[ | |
{ "keys": ["super+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, | |
{ "keys": ["super+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} }, | |
{ "keys": ["super+d"], "command": "duplicate_line" }, | |
{ "keys": ["super+shift+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+k"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, | |
{ "keys": ["ctrl+shift+c"], "command": "show_original_part" }, | |
{ "keys": ["ctrl+shift+r"], "command": "replace_modified_part" }, | |
{ "keys": ["ctrl+shift+d"], "command": "show_diff" }, |
// Generated by CoffeeScript 1.3.3 | |
/* | |
SERVER | |
*/ | |
var app, cookie, db, express, fs, io, port, server; | |
port = 3000; | |
fs = require('fs'); |
### | |
SERVER | |
### | |
port = 3000 | |
fs = require('fs') | |
express = require('express') | |
cookie = require('express/node_modules/cookie') | |
app = express() |
#server | |
logins = [] | |
io.sockets.on 'connection', (client) -> | |
client.on 'join', (data) -> | |
# checks if data.login account exists | |
db.users.findOne {login: data.login}, (err, user) -> | |
# user found |
// Returns an array of x random elements with the sum of X | |
function randomArray(X, max) { | |
var last = -1, res = []; | |
while (X > 0 && res.length < max) { | |
var x = Math.ceil(Math.random()*X); | |
res.push(x); | |
X -= x; | |
last += 1; | |
} | |
if (X > 0) { |