Skip to content

Instantly share code, notes, and snippets.

@samny
samny / fint-class-regex.txt
Created November 3, 2017 11:01
Find class usage regex
class[ \t]*=[ \t]*"[^"]*classname[^"]*"
@samny
samny / placeholder.svg
Last active September 16, 2020 12:02
SVG Placeholder image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(function() {
var Boss3, tr;
importScripts('../base-robot.js');
Boss3 = (function(superclass) {
var idleCount, prototype = extend$((import$(Boss3, superclass).displayName = 'Boss3', Boss3), superclass).prototype, constructor = Boss3;
idleCount = 0;
prototype.doSearch = function() {
this.turn_turret_right(45);
this.turn_right(15);
this.move_forwards(25);
@samny
samny / gist:d26fb1e4f4be9c748e74
Created July 16, 2015 09:18
Custom input directive with ngModel
angular
.module('app', [])
.directive('myThings', function() {
return {
require: 'ngModel',
controllerAs: 'vm',
bindToController: true,
scope: {
options: '=myThings'
},
@samny
samny / app.module.js
Last active August 29, 2015 14:25
Wait for promise resolve before triggering route
angular
.module('app', ['ui.router'])
.config(function ($urlRouterProvider) {
$urlRouterProvider.deferIntercept();
});
.run(function ($rootScope, $urlRouter, WaitForThis) {
var deRegister = $rootScope.$on('$locationChangeSuccess', function (e) {
e.preventDefault();
GIT_CURL_VERBOSE=2 git ls-remote --heads https://github.domain.com/user-name/repo-name.git
* Couldn't find host github.domain.com in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
* Trying XXX.XX.XX.XX...
* Connected to github.domain.com (XXX.XX.XX.XX) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
* Server certificate: *.domain.com
* Server certificate: DigiCert SHA2 Secure Server CA
* Server certificate: DigiCert Global Root CA
> GET /user-name/repo-name.git/info/refs?service=git-upload-pack HTTP/1.1
@samny
samny / post-receive
Created January 13, 2015 21:50
Git deploy after push
#!/bin/bash
GIT_DIR=$(dirname $(dirname $(readlink -f $0)))
DEPLOY_DIR=/srv/www/$(basename $GIT_DIR)/public_html
git "--work-tree=${DEPLOY_DIR}" "--git-dir=${GIT_DIR}" checkout -f
@samny
samny / dl-dt-with-multiple-dd-style.css
Last active May 23, 2017 10:19
Best way I found of styling a definition list as name value pairs and allowing either dt or dl to span multiple rows. http://www.css-101.org/articles/glossary-and-table-format/definition-list.php
dl.job-info{
width:100%;
overflow:hidden;
}
dl.job-info dt {
font-weight:600;
float:left;
width:49%;
@samny
samny / jquery.deparam.js
Created December 12, 2012 17:22
jQuery.deparam - The oposite of jQuery param. Creates an object of query string parameters
/**
* jQuery.deparam - The oposite of jQuery param. Creates an object of query string parameters.
*
* Credits for the idea and Regex:
* http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
*/
(function($){
$.deparam = $.deparam || function(uri){
if(uri === undefined){
uri = window.location.search;
@samny
samny / .gitignore
Created August 30, 2012 14:29
My default gitignore (forked from old h5bp)
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~