Skip to content

Instantly share code, notes, and snippets.

View deletosh's full-sized avatar

Dele Tosh deletosh

View GitHub Profile
var array1 = [0,8,1,0,0,0,8,6,7,8,9,5,2,6,3,0,7,4,1,1,0,0,7,0,0,8,6,7,8,9,5,9,1,1,3,0];
var array2 = [1,0,0,0,8,6,7,8,9,1,3,0,0,8,5,2,6,3,0,7,4,1,1,0,0,7,0,0,8,6,7,8,9,5,9,1];
var array3 = [1,0,5,2,6,3,0,7,4,1,1,0,0,7,0,0,8,6,7,8,9,5,0,0,8,6,7,8,9,1,3,0,0,8,9,1];
function findPattern(array, array1, array2){
var result=0;
for(i=0; i<array.length; i++){
if( array[i] == 1 &&
array[i+1] == 3 &&
@deletosh
deletosh / iMarcist 2
Created February 29, 2012 20:20
for iMarcist 2
#!/usr/bin/env bash
# about ::
# the master form for deploys and rollbacks.
# there is the part that sits on one server (staging?)
# and the one on the server that needs to be deployed to (production?)
# Copyright (c) 2012 Dele Omotosho
# GPLv3 : http://www.gnu.org/licenses/gpl-3.0.html
@deletosh
deletosh / imarcNet1
Created February 29, 2012 20:18
for iMarcist 1
private function _twitter($tweet_count, $username) {
if (empty($username)) {
return false;
}
// $this->_fetch_tweet();
$tweets = get_transient('recent_tweets_widget');
if (!$tweets) {
$this->_fetch_tweets($tweet_count, $username);
}
http://programming-motherfucker.com/
@deletosh
deletosh / gist:2499402
Created April 26, 2012 13:02 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@deletosh
deletosh / .htaccess
Created May 6, 2012 09:42
Yii .htaccess
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
@deletosh
deletosh / HTML::helper (kohana)
Created May 21, 2012 15:24
add the multiple scripts/styles in kohana
<?php defined('SYSPATH') or die('No direct script access.');
class HTML extends Kohana_HTML {
public static function scripts(array $scripts, $attributes=array(), $index = FALSE)
{
$response = '';
//Data sanitisation
$index = $index ? TRUE : false;
if ( !is_array($attributes) ) $attributes = array();
RewriteEngine On
RewriteBase /
RewriteRule ^(application|modules|system) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
@deletosh
deletosh / yii-htaccess
Created June 11, 2012 01:26
yii URL-ReWrite
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
@deletosh
deletosh / gist:2923868
Created June 13, 2012 12:48
git commands

delete a remote tag

If you have a tag named '12345' then you would just do this:

git tag -d 12345
git push origin :refs/tags/12345
```