This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
void reverse(char str[]) { | |
int len = strlen(str); | |
int i; | |
for(i = 0; i < (len / 2); i++) { | |
char c = str[i]; | |
str[i] = str[len - i - 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-available/default | |
upstream my_app_name { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/my_app_name.socket fail_timeout=0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/unicorn.rb | |
# Set environment to development unless something else is specified | |
env = ENV["RAILS_ENV"] || "development" | |
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete documentation. | |
worker_processes 2 # amount of unicorn workers to spin up | |
listen "/tmp/my_app_name.socket" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/capistrano" | |
set :application, "my_app_name" | |
set :repository, "git://github.com/user/my_app_name.git" | |
set :scm, :git | |
# set :deploy_to "/u/apps/#{application}" | |
role :web, "www.my_app_name.com" # Your HTTP server, Apache/etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a simple function that will test the performance of a JavaScript function. | |
* It should be noted that it may not be extremely accurate because it depends on your | |
* JavaScript runtime's implementation of getTime(). Most of the time, it works great. | |
* | |
* (For more on performance testing, see http://ejohn.org/blog/accuracy-of-javascript-time/) | |
* | |
* Here is an example of how to run a performance test: | |
* var result = pfTest(function () { var testAssignment = 0; }, 50); | |
* console.log(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) | |
# Load posh-git module from current directory | |
Import-Module .\posh-git | |
# If module is installed in a default location ($env:PSModulePath), | |
# use this instead (see about_Modules for more information): | |
# Import-Module posh-git | |
function Write-Git-Branch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valid([]). | |
valid([Head|Tail]) :- fd_all_different(Head), valid(Tail). | |
sudoku9(Puzzle, Solution) :- | |
Solution = Puzzle, | |
Puzzle = [S11, S12, S13, S14, S15, S16, S17, S18, S19, | |
S21, S22, S23, S24, S25, S26, S27, S28, S29, | |
S31, S32, S33, S34, S35, S36, S37, S38, S39, | |
S41, S42, S43, S44, S45, S46, S47, S48, S49, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js"></script> | |
<script> | |
var app = angular.module('myModule', []); | |
app.directive('leftPanel', function() { | |
return { | |
restrict: 'EA', //E = element, A = attribute, C = class, M = comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script builds the iOS and Mac openSSL libraries | |
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script | |
# Credits: | |
# https://github.com/st3fan/ios-openssl | |
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh | |
# | |
# Original: https://gist.github.com/foozmeat/5154962 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClLCD | |
1→NEWX | |
1→NEWY | |
21→OX | |
8→OY | |
10→NEWSX1 | |
8→NEWSY1 | |
15→NEWSX2 | |
2→NEWSY2 | |
0→TIMER |
OlderNewer